﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using University.Workshop.Presenters.OtbData.Read;

namespace University.Workshop.Presentation.OTBData.Read
{
    /// <summary>
    /// Interaction logic for ReadOtbDataPrincipal.xaml
    /// </summary>
    public partial class ReadOtbDataPrincipal : Page, IReadPrincipalView
    {
        PresenterReadOtbData pReadOtbData;
        IReadBasicOtbDataView readBasicValue;
        public ReadOtbDataPrincipal(Model.OtbData otb)
        {
            InitializeComponent();
            pReadOtbData = new PresenterReadOtbData(this, otb);
        }

        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            frmContent.Navigate(new PageFirstStepReadOtbData(pReadOtbData));
            pReadOtbData.FirstTime();
        }

        public IReadBasicOtbDataView ReadBasic
        {
            get
            {
                return readBasicValue;
            }
            set
            {
                readBasicValue = value;
            }
        }

        #region Buttons
        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            this.NavigationService.Navigate(new SearchOtbData());
        }

        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            pReadOtbData.GoNextPage();
        }

        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            pReadOtbData.GoBackPage();
        }

        private void GoStepOne_Click(object sender, RoutedEventArgs e)
        {
            pReadOtbData.GoStepOne();
        }

        private void GoStepTwo_Click(object sender, RoutedEventArgs e)
        {
            pReadOtbData.GoStepTwo();
        }

        #endregion

        #region Calls to Pages
        public void CallFirstPage()
        {
            PageFirstStepReadOtbData pp = new PageFirstStepReadOtbData(pReadOtbData);
            readBasicValue = pp;
            frmContent.NavigationService.Navigate(pp);
        }

        public void CallSecondPage()
        {
            PageSecondStepReadOtbData pp = new PageSecondStepReadOtbData(pReadOtbData);
            readBasicValue = pp;
            frmContent.NavigationService.Navigate(pp);
            goStepTwoBtn.IsEnabled = true;
        }
        #endregion
    }
}
